const { defineConfig } = require('@vue/cli-service')

const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ["js", "css"]

module.exports = defineConfig({
  outputDir:"dist",
  assetsDir:'static',
  publicPath:'./',
  lintOnSave: false,
  transpileDependencies: true,
  devServer:{
    port:8300,
    proxy:{
      '/website-api': {
        target: 'http://localhost:8200',
        secure: false,
        changeOrigin: true
      }
    }
  },
  configureWebpack: {
    plugins: [
      new CompressionWebpackPlugin({
        filename: "[path][base].gzip",
        algorithm: "gzip",
        test: new RegExp("\\.(" + productionGzipExtensions.join("|") + ")$"),
        threshold: 10240, //内容超过10KB进行压缩
        minRatio: 0.8,
      }),
    ]
  }
})
